"use client";

import {
  useSession,
  SessionProvider as NextAuthProvider,
} from "next-auth/react";

export function UserInfo() {
  const { data: session } = useSession();
  console.log("session", session);

  return (
    <div>
      {session ? (
        <div>
          <p>Signed in as {session.user?.email}</p>
          {session.user?.image && (
            <img
              src={session.user.image}
              alt="User Image"
              width={50}
              height={50}
              style={{ borderRadius: "50%" }}
            />
          )}
        </div>
      ) : (
        <p>Not signed in</p>
      )}
    </div>
  );
}

export function SessionProvider({ children }: { children: React.ReactNode }) {
  return <NextAuthProvider>{children}</NextAuthProvider>;
}
